package com.qys.livesMall.anchor.controller.sys;


import com.qys.livesMall.anchor.model.vo.lives.sys.AnchorRewardConfigVO;
import com.qys.livesMall.anchor.service.AnchorRewardConfigService;
import com.qys.livesMall.common.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 主播奖励配置(AnchorRewardConfig)表控制层
 *
 * @author makejava
 * @since 2023-10-24 15:13:59
 */
@RestController
@RequestMapping("/sys/anchorRewardConfig")
@Tag(name = "sys-主播奖励配置", description = "sys-主播奖励配置")
public class AnchorRewardConfigController {
    /**
     * 服务对象
     */
    @Resource
    private AnchorRewardConfigService anchorRewardConfigService;


    @GetMapping("/page/{type}")
    @Operation(summary = "获取所有配置", description = "奖励类型（1升级奖励，2累计收益奖励，3粉丝量奖励，4首次直播时长奖励，5收益日榜奖励，6收益月榜奖励，7用户观看时长奖励，8用户赠送礼物奖励）")
    public R<List<AnchorRewardConfigVO>> getPage(@PathVariable Integer type){
        return R.ok(anchorRewardConfigService.getPage(type));
    }

    @PostMapping("/add")
    @Operation(summary = "新增配置")
    public R<?> add(@RequestBody AnchorRewardConfigVO dto){
        anchorRewardConfigService.add(dto);
        return R.ok();
    }

    @PostMapping("/del/{id}")
    @Operation(summary = "删除配置")
    public R<?> del(@PathVariable Long id){
        anchorRewardConfigService.del(id);
        return R.ok();
    }

}

